﻿#ifndef QGROUPCHAT_H
#define QGROUPCHAT_H
#pragma once

#include <QWidget>
#include <QProcess>
#include <QCheckBox>
#include <QListWidget>
#include <QListWidgetItem>
#include <QIcon>
#include <QFile>
#include <QTimer>
#include <QTcpSocket>

namespace Ui {
class QGroupChat;
}

class QGroupChat : public QWidget
{
    Q_OBJECT

public:
    explicit QGroupChat(QWidget *parent = nullptr);
    ~QGroupChat();
    QString getGroupName();
    void setGroupName(QString);
    void loadGroupPerson(QString,QString,int);//加载群成员
    QPixmap PixmapToRound(const QPixmap &src, const int &radius);//生成头像
    QWidget *CreateWidgetL_R(int i,QString name,QString data);//创建聊天时的左右窗口
    QWidget *CreateWidgetL_R(int i,QString name,QPixmap pix);//创建聊天时的左右窗口
    void addMsgWidget(QWidget* widget);
    void clearGroupPersonList();
    void updateGroupPersonList(QString name,int i);
    void setGroupNotify(QString msg);
    void loadGroupChatRecord(QByteArray qba);
    void OnStartFileTrans();//开始文件传输
private slots:
    void on_tbtn_biaoqing_clicked();

    void on_tbtn_close_clicked();

    void on_tbtn_min_clicked();

    void on_btn_close_clicked();

    void on_btn_send_clicked();

    void on_tbtn_invite_clicked();

    void on_toolButton_clicked();

    void on_tbtn_jietu_clicked();

    void on_group_name_2_editingFinished();

    void on_toolButton_2_clicked();

    void on_pushButton_2_clicked();

    void on_tbtn_new_clicked();

    void on_pushButton_clicked();

private:
    Ui::QGroupChat *ui;
    QList<QCheckBox*> m_checkboxlist;
    int m_count;//记录总人数
    int m_num;//记录在线人数
    QString m_filename;
    QFile m_file;
    QTimer m_timer;
    QTcpSocket m_sock;
    QString m_gid;
};

#endif // QGROUPCHAT_H
